package com.charith;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import com.charith.om.Person;

public class Main {
	public static void main(String[] args) {
		Session session = null;
		try {
			SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
			session = sessionFactory.openSession();
			
			Person person = new Person();
			person.setName("Charith");
			session.save(person);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		finally{
			session.flush();
			session.close();
		}
	}
}
